home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5534 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.9 KB

  1. X-Mailer: MicroDot 1.10 [UNREGISTRIERT] via [DOS/NCBMail V2.21 REL.:160995]
  2. Message-ID: <xSLfXMD0aez4@point86.people-s.people.de>
  3. Organization: Artwork Demo Factories ..
  4. References: <38232442@kone.fipnet.fi> <4i4ekh$8t4@sunsystem5.informatik.tu-muenchen.de>
  5. X-Gateway: ZCONNECT UU people-s.people.de [DUUCP vom 01.07.1994]
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=ISO-8859-1
  8. Content-Transfer-Encoding: 8bit
  9. From: azure@people-s.people.de (Tim Boescke)
  10. Subject: Re: TMapping again!
  11. Date: 14 Mar 1996 23:20:39 +0100
  12. Path: people-s.people.de!azure
  13. Newsgroups: comp.sys.amiga.programmer
  14. Distribution: world
  15.  
  16.  
  17. Reply to Re: TMapping again! / 12.03.1996
  18.  
  19.  
  20. JF> |> JF> |> >     A time ago I did an approach to this problem using a similar trick
  21. JF> |> JF> |> >     than my two-command mapper.
  22. JF> |> JF> |> >     (btw. actually this one WORKS .. I have tried it out)
  23. JF> |> JF> |> > 
  24. JF> |> JF> |> >         move.l  d3,d2           ;d3=d4=0000000000000XXXXXXXxxxxxxYYYYYY
  25. JF> |> JF> |> >         move    d0,d5           ;d0=a6=yyyyyyyy000000000000BBBBBBbbbbbb
  26. JF> |> JF> |> >         and.l   d6,d2           ;d6=   00000000000001111111000000111111
  27. JF> |> JF> |> >         and.b   d7,d5           ;d7=   xxxxxxxxxxxxxxxxxxxxxxxx11000000
  28. JF> |> JF> |> >         or      d5,d2
  29. JF> |> JF> |> >         move.b  (a4,d2.l),(a2)+ ;d2=   00000000000000xxxxxxbbbbbbyyyyyy
  30. JF> |> JF> |> >         add.l   a6,d0
  31. JF> |> JF> |> >         addx.l  d4,d3
  32. JF> |> JF> |> > 
  33. JF> |> JF> |> >      This one is doing Texturemapping + gouraud shading with
  34. JF> |> JF> |> >      shadetable. (!!)
  35. JF> |> JF> |> > 
  36. JF> |> JF> |> >      The Texture is 64x64 (6 bit) and the shading is 6 bit two. You
  37. JF> |> JF> |> >      will need a 256k combined Texture/Shading table.
  38. JF> |> JF> |> 
  39. JF> |> JF> |> Hmm. Not nice in a game for example where several textures
  40. JF> |> JF> |> are needed. But a nice idea anyway!
  41. JF> |> 
  42. JF> |>     YOu can use this code with several textures. For example you could
  43. JF> |>     split up the shading range. For example B=0-31 is textere one and
  44. JF> |>     B=32-63 is Texture two.. etc. or use 32x32 textures...
  45.  
  46. JF> |> JF> The example does too much instructions :) but allows more general
  47. JF> |> JF> mem usage.
  48. JF> |> JF> 
  49. JF> |> JF> What about this...
  50. JF> |> JF> 
  51. JF> |> JF>  add.l  a2,d2          0...00BBBbbbbbbbbbbbbbbbb
  52. JF> |> JF>  add.l  a3,d1          x...xxxxxYYYYYYYYyyyyyyyy
  53. JF> |> JF>  addx.l d3,d0          0...0000000000000XXXXXXXX
  54. JF> |> JF>  move.l d2,d6
  55. JF> |> JF>  move.w d1,d6
  56. JF> |> JF>  move.b d0,d6
  57. JF> |> JF>  move.b 0(a0,d6.l),(a1)+
  58. JF> |> JF> 
  59. JF> |> JF> 20 cycles gouraud mapping :)
  60. JF> |> JF> 
  61. JF> |> JF> 8 shadingsteps are 512k, not too much even for a A1200 game imho 
  62. JF> |> JF> (well, people tell me they aim for higher machines anyway,
  63. JF> |> JF> so the mem consumption can't be considered so bad ;)
  64. JF> |> 
  65. JF> |>     Welll. of course this is two cycles faster, but it takes twice the
  66. JF> |>     memory and 8 shading steps are simply not enough ;)
  67. JF> why twice the mem ?
  68.  
  69.      Because my loops table takes only 256k for 64x64x64.. but ok. the amount
  70.      of data is the same. Its just spread different in the memory.
  71.  
  72. JF> it can do also 16 steps, just like yours.
  73.  
  74.     nope.. My has 64 shading steps..
  75.  
  76. JF> n colors shaded textures, needing 2^(n-1) times more mem, just like yours :)
  77.  
  78.     Yep.. 4mb for 64 shading steps. Simply too much!  Thats why I did
  79.     this bit-fiddling !!
  80.  
  81. JF> |> JF> I would really think about using this routine, it's really LOT quicker.
  82. JF> |> JF> You can put multiple textures into a given 64k range btw. but those can't
  83. JF> |> JF> be "repeart-mapped" uh "multiplexed" ? how you call it if x gets 256 and then
  84. JF> |> JF> _plop_, 0 again on the left side ? Is this called bump-mapping ? :D
  85. JF> |> 
  86. JF> |>     wrap-around textures ?? Well erhm.. Bump-mapping is a bit different.
  87. JF> 
  88. JF> not knowing what it is I can imagine it is a bit different, though the ":D" ;)
  89. JF> so what is bump-mapping ?
  90.  
  91.     Bump mapping is Phong-shading with a bumpmap. The bumpmap contains
  92.     a list of angles. These are added to the polys normal, so that you
  93.     can simulate rough surfaces etc. In my TP5 Intro ("Creep") is a bump-
  94.     mapped torus. Though the bumpmap is too small and there are some
  95.     light errors. But I fixed that by now.. wait and see. ;)
  96.  
  97. JF> wrap-around: imagine you scan over the border of a 256x256 texture.
  98. JF> pointer will be in same texture again, beacuse it's all "anded" to 64k.
  99. JF> you can have multiple times the same texture in one polygon this way.
  100. JF> 
  101. JF> when using the 256x256 space for storting multiple textures (4 times
  102. JF> 128x128 etc) you loose "wrap-around" :) Is the word silly ? what you'd use
  103. JF> for it ?
  104.  
  105.     You could use my loop with a different AND-mask ..
  106.  
  107. --
  108.     +--------------------------------------------------------------------+
  109.     |      -  AZURE@PEOPLE-S.people.de - Tim Boescke - AZURE /atw.bzr    |
  110.     +---------------------------------<AMIGA,PC,C64,PLUS/4,VCS2600>------+
  111.